package com.albaba.designpattern.prototype.text_001;

import java.io.Serializable;

/**
 * @author zx
 * @version 1.0
 * @description 具体原型类 ：实现Cloneable接口，表示当前对象可复制
 * @date 2025/2/19 21:53
 */
public class ConcretePrototype implements Cloneable, Serializable {

    private Person person;

    public void show() {
        System.out.println("嫌疑人姓名：" + person.getName());
    }

    public ConcretePrototype() {
        System.out.println("具体原型创建成功！");
    }


    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    @Override
    protected ConcretePrototype clone() throws CloneNotSupportedException {
        System.out.println("克隆对象复制成功！");
        return (ConcretePrototype) super.clone();
    }
}
